package o;

import com.huawei.appgallery.foundation.ui.css.CSSStyleSheet;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.Layout;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.LayoutData;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean.a;
import java.util.List;
import java.util.ListIterator;

public class chi {
    public void ॱ(cia o_cia, chd o_chd, BaseDetailResponse baseDetailResponse, boolean z) {
        ॱ(o_cia, o_chd, baseDetailResponse);
        List ʻॱ = baseDetailResponse.ʻॱ();
        List ᐝॱ = baseDetailResponse.ᐝॱ();
        o_cia.csSheet = CSSStyleSheet.parse(baseDetailResponse.ॱˎ());
        o_cia.ˋ(baseDetailResponse.getResponseType() == a.UPDATE_CACHE);
        o_cia.ʻ = o_chd.ˏ() + 1;
        ˏ(o_cia, ʻॱ, o_chd.ˎ());
        ˊ(o_cia, o_chd, baseDetailResponse, ˋ(o_cia, ᐝॱ));
        if (baseDetailResponse.ॱ() == 0) {
            o_cia.ˊ(false);
        } else {
            o_cia.ˊ(true);
        }
        ˊ(o_cia, o_chd, baseDetailResponse);
        if (CollectCheck.isEmpty(ʻॱ) || CollectCheck.isEmpty(ᐝॱ)) {
            z = false;
        }
        if (z) {
            o_cia.ͺ();
        }
    }

    protected void ॱ(cia o_cia, chd o_chd, BaseDetailResponse baseDetailResponse) {
    }

    protected void ˊ(cia o_cia, chd o_chd, BaseDetailResponse baseDetailResponse) {
    }

    protected void ˏ(cia o_cia, List<Layout> list, String str) {
        if (CollectCheck.isEmpty((List) list) || o_cia == null) {
            Logger.ˋ("DataProviderCreator", "analyseLayouts, provider = " + o_cia);
            return;
        }
        Logger.ˎ("DataProviderCreator", "analyseLayouts, already hava layout size = " + o_cia.ॱˊ() + ", receive new layout size: " + list.size());
        for (Layout layout : list) {
            String ˎ = layout.ˎ();
            if (layout.ॱ() == -1) {
                Logger.ˋ("DataProviderCreator", "analyseLayouts, unsupport card: " + ˎ);
            } else {
                chz ˋ = ˋ(o_cia, layout, str);
                if (ˋ != null) {
                    ˋ.ˋ(o_cia.csSheet, layout.ˏ());
                    ˋ.ॱ(ˎ);
                    ˋ.ˋ(o_cia.ॱᐝ());
                } else {
                    Logger.e("DataProviderCreator", "analyseLayouts, cardChunk == null");
                }
            }
        }
    }

    protected chz ˋ(cia o_cia, Layout layout, String str) {
        return o_cia.ॱ(layout.ˋ(), layout.ॱ(), layout.ˊ(), null, str);
    }

    protected int ˋ(cia o_cia, List<LayoutData<CardBean>> list) {
        int i = 0;
        if (CollectCheck.isEmpty((List) list)) {
            Logger.ˋ("DataProviderCreator", "analyseLayoutDatas, layoutdatas is empty");
        } else {
            int size = list.size();
            int i2 = 0;
            while (i2 < size) {
                int i3;
                LayoutData layoutData = (LayoutData) list.get(i2);
                long ˎ = layoutData.ˎ();
                chz ॱ = o_cia.ॱ(ˎ);
                if (ॱ == null) {
                    Logger.ˋ("DataProviderCreator", "analyseLayoutDatas, cardChunk == null");
                    i3 = i;
                } else {
                    List ˋ = layoutData.ˋ();
                    if (ˋ == null) {
                        Logger.ˋ("DataProviderCreator", "analyseLayoutDatas, dataList == null, layoutId:" + ˎ);
                        i3 = i;
                    } else {
                        ListIterator listIterator = ˋ.listIterator(ˋ.size());
                        while (listIterator.hasPrevious() && ॱ.ˋ.ˏ() != 0 && ˋ.size() / ॱ.ˋ.ˏ() >= ॱ.ˊ) {
                            ˋ(layoutData, ॱ, listIterator, (BaseCardBean) listIterator.previous());
                        }
                        List ˏ = ˏ(ˋ);
                        if (i2 == size - 1) {
                            ˋ(o_cia, ॱ, ˏ);
                        }
                        i3 = ˏ.size() + i;
                        ॱ.ˎ(ˏ);
                        ˋ(ॱ);
                    }
                }
                i2++;
                i = i3;
            }
            Logger.ˎ("DataProviderCreator", "analyseLayoutDatas, receive new layoutdata, size: " + i);
        }
        return i;
    }

    protected void ˊ(cia o_cia, chd o_chd, BaseDetailResponse baseDetailResponse, int i) {
    }

    protected void ˋ(cia o_cia, chz o_chz, List<CardBean> list) {
    }

    protected void ˋ(chz o_chz) {
    }

    protected void ˋ(LayoutData<CardBean> layoutData, chz o_chz, ListIterator<CardBean> listIterator, BaseCardBean baseCardBean) {
        if (o_chz.ˎ(baseCardBean.ˋ())) {
            listIterator.remove();
            Logger.ˎ("DataProviderCreator", "filter, node isDuplicate = " + baseCardBean.getClass().getSimpleName() + ", cardId = " + baseCardBean.ˋ());
        } else if (baseCardBean.ˋ(ˋ((LayoutData) layoutData))) {
            listIterator.remove();
            Logger.ˎ("DataProviderCreator", "filter, bean: " + baseCardBean.getClass().getSimpleName() + ", cardId = " + baseCardBean.ˋ());
        } else {
            ˋ(o_chz, baseCardBean);
        }
    }

    protected int ˋ(LayoutData<CardBean> layoutData) {
        return 0;
    }

    protected void ˋ(chz o_chz, BaseCardBean baseCardBean) {
    }

    protected List<CardBean> ˏ(List<CardBean> list) {
        return list;
    }
}
